<template>
  <div class="page6 wow" style="visibility: visible">
    <h2>
      全案服务 创造
      <span>精彩生活</span>
    </h2>
    <div class="swipers">
      <swiper @slideChange="onSlideChange" @swiper="onSwiper" :initialSlide="inivalue">
        <swiper-slide v-for="(item, index) in List" :key="index">
          <div class="img-wrap">
            <img alt="" :src="item.image" />
            <div class="text">
              <h5>设计服务</h5>
              <h6>众多优秀设计师团队，为您制定细致入微的个性化方案</h6>
              <div class="button-wrap">
                <div class="btn">了解更多</div>
              </div>
            </div>
          </div>
        </swiper-slide>
      </swiper>
    </div>
    <div class="bg-wrap">
      <h3>全案服务</h3>
      <ul>
        <li
          :class="{ active: inivalue == index }"
          v-for="(item, index) in List"
          :key="index"
          @click="upinivalue(index)"
        >
          <div>
            <img alt="" :src="item.n" />
            <img alt="" :src="item.y" />
          </div>
          <h4>{{ item.title }}</h4>
        </li>
      </ul>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { Swiper, SwiperSlide } from 'swiper/vue'
import 'swiper/css'
const inivalue = ref(0)
const List = ref([
  {
    title: '设计服务',
    image: '/src/assets/img/p6_banner.jpg',
    y: '/src/assets/img/qa011.png',
    n: '/src/assets/img/qa001.png'
  },
  {
    title: '材料服务',
    image: '/src/assets/img/p6_banner.jpg',
    y: '/src/assets/img/qa022.png',
    n: '/src/assets/img/qa002.png'
  },
  {
    title: '配套服务',
    image: '/src/assets/img/p6_banner.jpg',
    y: '/src/assets/img/qa033.png',
    n: '/src/assets/img/qa003.png'
  },
  {
    title: '软装服务',
    image: '/src/assets/img/p6_banner.jpg',
    y: '/src/assets/img/qa044.png',
    n: '/src/assets/img/qa004.png'
  },
  {
    title: '工程服务',
    image: '/src/assets/img/p6_banner.jpg',
    y: '/src/assets/img/qa055.png',
    n: '/src/assets/img/qa005.png'
  },
  {
    title: '质检服务',
    image: '/src/assets/img/p6_banner.jpg',
    y: '/src/assets/img/qa066.png',
    n: '/src/assets/img/qa006.png'
  },
  {
    title: '售后服务',
    image: '/src/assets/img/p6_banner.jpg',
    y: '/src/assets/img/qa077.png',
    n: '/src/assets/img/qa007.png'
  }
])
const iniswiper = ref(null)
const onSwiper = (swiper) => {
    iniswiper.value = swiper
}
const onSlideChange = (e)=>{
    inivalue.value = e.activeIndex
}
const upinivalue = (index)=>{
    iniswiper.value.slideTo(index)
    inivalue.value = index
}
</script>

<style>
.home .page6 {
  position: relative;
  margin-top: 1rem;
  opacity: 0;
  animation: slide-down-in 1s, fade-in 1s;
  animation-fill-mode: forwards;
}

.home .page6 > h2 {
  position: absolute;
  top: 1rem;
  z-index: 99;
  left: 0;
  width: 100%;
  padding-left: 0.29rem;
  font-size: 0.56rem;
  font-weight: 700;
  color: #fff;
  line-height: 0.65rem;
}

.home .page6 > h2 span {
  color: #dd292c;
}

.home .page6 .swipers .img-wrap {
  position: relative;
  height: 8.6rem;
  overflow: hidden;
}

.home .page6 .swipers .img-wrap img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
}

.home .page6 .swipers .img-wrap:after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.2);
}

.home .page6 .swipers .text {
  position: absolute;
  top: 3.84rem;
  left: 0.3rem;
  width: 100%;
  z-index: 3;
}

.home .page6 .swipers .text h5 {
  font-size: 0.42rem;
  font-weight: 400;
  color: #fff;
}

.home .page6 .swipers .text h6 {
  font-size: 0.24rem;
  font-weight: 400;
  margin: 0.28rem 0 0.62rem;
  color: #fff;
}

.home .page6 .bg-wrap {
  background: url(/src/assets/img/p6_bj.png) no-repeat;
  background-size: 100% auto;
  width: 100%;
  height: 6.71rem;
  margin-top: -0.85rem;
  position: relative;
  z-index: 99;
  padding: 0.84rem 0.3rem 0.3rem;
}

.home .page6 .bg-wrap h3 {
  font-size: 0.32rem;
  font-weight: 700;
  color: #000;
  margin-bottom: 0.47rem;
}

.home .page6 .bg-wrap ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.home .page6 .bg-wrap ul li {
  width: 1.6rem;
  height: 2.03rem;
  background: #fff;
  border-radius: 0.1rem;
  margin-bottom: 0.17rem;
  cursor: pointer;
  transition: none;
}

.home .page6 .bg-wrap ul li:nth-child(2) {
  margin-right: 0.15rem;
  margin-left: 0.15rem;
}

.home .page6 .bg-wrap ul li:nth-child(3) {
  margin-right: 0.15rem;
}

.home .page6 .bg-wrap ul li:nth-child(6) {
  margin-right: 0.15rem;
  margin-left: 0.15rem;
}

.home .page6 .bg-wrap ul li div {
  height: 1.4rem;
  position: relative;
}

.home .page6 .bg-wrap ul li div img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 1;
  max-width: 0.73rem;
}

.home .page6 .bg-wrap ul li div img:nth-child(2) {
  opacity: 0;
}

.home .page6 .bg-wrap ul li h4 {
  font-size: 0.26rem;
  font-weight: 700;
  color: #000;
  text-align: center;
}

.home .page6 .bg-wrap ul li.active {
  background: #dd292c;
  box-shadow: 0 0.1rem 0.3rem 0 rgba(237, 84, 0, 0.25);
}

.home .page6 .bg-wrap ul li.active img {
  opacity: 0;
}

.home .page6 .bg-wrap ul li.active img:nth-child(2) {
  opacity: 1;
}

.home .page6 .bg-wrap ul li.active h4 {
  color: #fff;
}
</style>